package GameElements;
import org.joda.time.DateTime;



/**
 * This class extends from CtowerDefenseELement and implements Attrate
 * @author Mohamad
 *
 */
public class CTDBuffTower extends CTowerDefenseElement implements Attrate{

	private int buffrate;
	private int buffamount;
	private int buffrange;
	private String bufftype;
	DateTime now = new DateTime();
    DateTime nextWave = new DateTime();
	private boolean readyForShoot = false;
	
	public String getBufftype() {
		return bufftype;
	}
	public void setBufftype(String bufftype) {
		this.bufftype = bufftype;
	}
	public int getBuffrate() {
		return buffrate;
	}
	public void setBuffrate(int buffrate) {
		this.buffrate = buffrate;
	}
	

	public void updateAttrate()
	{	
		nextWave = new DateTime();
		nextWave = nextWave.plusMillis(buffrate);		
	}
	public void checkForShoot()
	{
		now = new DateTime();
		if(now.isAfter(nextWave))
			readyForShoot = true;
		else
			readyForShoot = false;
	}
	
	public boolean checkAttrate()
	{
		checkForShoot();
        if(readyForShoot==true)
        	updateAttrate();
        return readyForShoot;		
	}
	public int getBuffamount() {
		return buffamount;
	}
	public void setBuffamount(int buffamount) {
		this.buffamount = buffamount;
	}
	public int getBuffrange() {
		return buffrange;
	}
	public void setBuffrange(int buffrange) {
		this.buffrange = buffrange;
	}
}
